/*
 * Generated by XDoclet - Do not edit!
 */
package hotel.interfaces;

/**
 * Value object for Habitacio.
 *
 * @xdoclet-generated at ${TODAY}
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version ${version}
 */
public class HabitacioValue
   extends java.lang.Object
   implements java.io.Serializable 
{
   private java.lang.Integer ID;
   private boolean IDHasBeenSet = false;
   private java.lang.Integer tipus;
   private boolean tipusHasBeenSet = false;

   private hotel.interfaces.HabitacioPK pk;

   public HabitacioValue()
   {
	  pk = new hotel.interfaces.HabitacioPK();
   }

   public HabitacioValue( java.lang.Integer ID,java.lang.Integer tipus )
   {
	  this.ID = ID;
	  IDHasBeenSet = true;
	  this.tipus = tipus;
	  tipusHasBeenSet = true;
	  pk = new hotel.interfaces.HabitacioPK(this.getID());
   }

   //TODO Cloneable is better than this !
   public HabitacioValue( HabitacioValue otherValue )
   {
	  this.ID = otherValue.ID;
	  IDHasBeenSet = true;
	  this.tipus = otherValue.tipus;
	  tipusHasBeenSet = true;

	  pk = new hotel.interfaces.HabitacioPK(this.getID());
   }

   public hotel.interfaces.HabitacioPK getPrimaryKey()
   {
	  return pk;
   }

   public void setPrimaryKey( hotel.interfaces.HabitacioPK pk )
   {
      // it's also nice to update PK object - just in case
      // somebody would ask for it later...
      this.pk = pk;
	  setID( pk.ID );
   }

   public java.lang.Integer getID()
   {
	  return this.ID;
   }

   public void setID( java.lang.Integer ID )
   {
	  this.ID = ID;
	  IDHasBeenSet = true;

		 pk.setID(ID);
   }

   public boolean IDHasBeenSet(){
	  return IDHasBeenSet;
   }
   public java.lang.Integer getTipus()
   {
	  return this.tipus;
   }

   public void setTipus( java.lang.Integer tipus )
   {
	  this.tipus = tipus;
	  tipusHasBeenSet = true;

   }

   public boolean tipusHasBeenSet(){
	  return tipusHasBeenSet;
   }

   public String toString()
   {
	  StringBuffer str = new StringBuffer("{");

	  str.append("ID=" + getID() + " " + "tipus=" + getTipus());
	  str.append('}');

	  return(str.toString());
   }

   /**
    * A Value Object has an identity if the attributes making its Primary Key have all been set. An object without identity is never equal to any other object.
    *
    * @return true if this instance has an identity.
    */
   protected boolean hasIdentity()
   {
	  boolean ret = true;
	  ret = ret && IDHasBeenSet;
	  return ret;
   }

   public boolean equals(Object other)
   {
      if (this == other)
         return true;
	  if ( ! hasIdentity() ) return false;
	  if (other instanceof HabitacioValue)
	  {
		 HabitacioValue that = (HabitacioValue) other;
		 if ( ! that.hasIdentity() ) return false;
		 boolean lEquals = true;
		 if( this.ID == null )
		 {
			lEquals = lEquals && ( that.ID == null );
		 }
		 else
		 {
			lEquals = lEquals && this.ID.equals( that.ID );
		 }

		 lEquals = lEquals && isIdentical(that);

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

   public boolean isIdentical(Object other)
   {
	  if (other instanceof HabitacioValue)
	  {
		 HabitacioValue that = (HabitacioValue) other;
		 boolean lEquals = true;
		 if( this.tipus == null )
		 {
			lEquals = lEquals && ( that.tipus == null );
		 }
		 else
		 {
			lEquals = lEquals && this.tipus.equals( that.tipus );
		 }

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

   public int hashCode(){
	  int result = 17;
      result = 37*result + ((this.ID != null) ? this.ID.hashCode() : 0);

      result = 37*result + ((this.tipus != null) ? this.tipus.hashCode() : 0);

	  return result;
   }

}
